package com.seed.core.enumeration;

import cn.hutool.core.util.StrUtil;
import com.mybatisflex.annotation.EnumValue;

public enum Direction {
    asc("asc", "正序"),
    desc("desc", "倒序");


    private final String value;
    private final String label;

    Direction(String value, String label) {
        this.value = value;
        this.label = label;
    }

    public static Direction valueFrom(String s) {
        if(StrUtil.isBlank(s)) return asc;

        return s.equalsIgnoreCase("desc") ? desc : asc;
    }

    @EnumValue
    public String getValue() { return value; }

    public String getLabel() {
        return label;
    }
}
